package api

import (
	"config-client-v1/model"
	"github.com/gin-gonic/gin"
)

const LOGIN_KEY = "@go"

func GetUserToken(ctx *gin.Context) model.UserToken {
	val, _ := ctx.Get("userToken")
	userToken, _ := val.(model.UserToken)
	return userToken
}

func GetFrameIdByType(frameType string) (ids []int) {
	ids = make([]int, 0)
	_ = model.DB.Model(&model.Frame{}).Where("frame_type = ?", frameType).Pluck("id", &ids).Error
	return
}
